package com.smart.community.feign.property.service;

import com.smart.community.commons.vo.property.PropertyInfoVO;
import com.smart.community.commons.vo.property.PropertyInfoListVO;
import com.smart.community.feign.property.fallback.UserPropertyCompanyFeignFallback;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;

import java.util.List;

import javax.validation.constraints.NotNull;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * 用户物业公司关联Feign接口
 * 
 * @author Wu.Liang
 * @version 1.0.0
 * @since 2025-06-29
 */
@Tag(name = "用户物业公司关联Feign接口", description = "用户物业公司关联相关Feign接口")
@FeignClient(
    name = "smart-community-property",
    path = "/property",
    fallback = UserPropertyCompanyFeignFallback.class,
    contextId = "iUserPropertyCompanyFeign"
)
public interface IUserPropertyCompanyFeign {
    
    /**
     * 根据用户ID查询物业信息（单个物业公司，兼容旧版本）
     * 
     * @param userId 用户ID
     * @return 物业信息
     */
    @Operation(summary = "根据用户ID查询物业信息（单个物业公司，兼容旧版本）")
    @GetMapping("/feign/user-companies/user/{userId}")
    PropertyInfoVO getPropertyInfoByUserId(@Parameter(description = "用户ID") @PathVariable("userId") Long userId);
    
    /**
     * 根据用户ID查询物业信息列表
     * 
     * @param userId 用户ID
     * @return 物业信息列表
     */
    @Operation(summary = "根据用户ID查询物业信息列表")
    @GetMapping("/feign/user-companies/user/{userId}/list")
    PropertyInfoListVO getPropertyInfoListByUserId(@Parameter(description = "用户ID") @PathVariable("userId") Long userId);
    
    /**
     * 根据物业公司ID查询用户列表
     * 
     * @param propertyCompanyId 物业公司ID
     * @return 用户列表
     */
    @Operation(summary = "根据物业公司ID查询用户列表")
    @GetMapping("/feign/user-companies/property-company/{propertyCompanyId}")
    PropertyInfoVO getUsersByPropertyCompanyId(@Parameter(description = "物业公司ID") @PathVariable("propertyCompanyId") Long propertyCompanyId);
    
    /**
     * 检查用户是否有关联的物业公司
     * 
     * @param userId 用户ID
     * @return 是否有关联
     */
    @Operation(summary = "检查用户是否有关联的物业公司")
    @GetMapping("/feign/user-companies/check/{userId}")
    Boolean checkUserHasPropertyCompany(@Parameter(description = "用户ID") @PathVariable("userId") Long userId);

	@Operation(summary = "查询物业公司关联的用户ID", description = "查询物业公司关联的用户ID")
    @GetMapping("/feign/user-companies/user-list/{propertyCompanyId}")
	public List<Long> getUserIdsByPropertyCompanyId(@Parameter(description = "物业公司ID") @PathVariable @NotNull Long propertyCompanyId);
} 